package com.qingyun.system.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.OSSClientBuilder;
import com.qingyun.system.common.properties.AliYunOssProperties;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AlYunOSSConfig {

    @Resource
    private AliYunOssProperties aliOssProperties;

    @Bean
    public OSS ossClient(){
        return  new OSSClient(
                aliOssProperties.getEndpoint(),
                aliOssProperties.getAccessKey(),
                aliOssProperties.getSecretKey()
        );
    }
}
